package com.xyh;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class MyController {
      @RequestMapping(value = "/persion",method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
    public Persion getPersion(HttpServletRequest httpServletRequest){
      Persion p=new Persion();
      p.setId(1);
      p.setName("angus");
      p.setMessage(httpServletRequest.getRequestURL().toString());
      return p;
    }
}
